Given a number N, the task is to find the Nth number which has an absolute difference of 1 between every pair of its adjacent digits.Examples:...
Given an array, the task is to print or display all the reverse permutations of this array using STL in C++. Reverse permutation means, for an array {1, 2, 3}:...
Given a string S of size N consisting of unique ID and Domain Name of a unique website, the task is to find the ID and the Domain Name in the given string if the ID is of the form [char, char, char, char, char, digit, digit, digit, digit, char]....
Given an array of sorted integers. We need to find the closest value to the given number. Array may contain duplicate values and negative numbers....
Given a set of strings S and a string patt the task is to autocomplete the string patt to strings from S that have patt as a prefix, using a Ternary Search Tree. If no string matches the given prefix, print “None”.Examples:...
Check if a given number N is a perfect square or not. If yes then return the number of which it is a perfect square, Else print -1....
Prerequisites: Segment TreeGiven a number N which represents the size of the array initialized to 0 and Q queries to process where there are two types of queries:...
Given an unsorted array arr[] and an integer K, the task is to count the occurrences of K in the given array using the Divide and Conquer method....
In C++, both set and HashSet(also called unordered_set) are used to store elements but they have different properties and use cases. In this article, we will learn the key differences between a set and a HashSet in C++....
In C++, a deque (double-ended queue) is a container that allows insertion and removal of elements from both ends whereas an unordered set is a container that stores unique elements in no particular order. In this article, we will learn how to create a deque of unordered sets in C++ STL....
A number system can be considered as a mathematical notation of numbers using a set of digits or symbols. In simpler words, the number system is a method of representing numbers. Every number system is identified with the help of its base or radix....
Stringstream is stream class present in C++ which is used for doing operations on a string. It can be used for formatting/parsing/converting a string to number/char etc. Hex is an I/O manipulator that takes reference to an I/O stream as parameter and returns reference to the stream after manipulation. Here is a quick way to convert any decimal to hexadecimal using stringstream:...